home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 May: Tool Chest / Apple_Developer_CD_Series_May_1994_Tool_Chest.iso / Tool Chest / Interfaces / Universal Interfaces / time.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-10  |  1.9 KB  |  91 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3.     time.h
  4.     Date and time
  5.     
  6.     Copyright © Apple Computer,Inc.  1987-1993.
  7.     All Rights Reserved.
  8.  
  9. ************************************************************/
  10.  
  11.  
  12. #ifndef __TIME_H__ /* __TIME__ is a reserved preprocessor symbol */
  13. #define __TIME_H__
  14.  
  15. #ifndef NULL
  16. #define NULL 0
  17. #endif
  18.  
  19. #ifndef __size_t__
  20. #define __size_t__
  21. #ifdef powerc
  22. typedef unsigned long size_t;
  23. #else
  24. typedef unsigned int size_t;
  25. #endif /* powerc */
  26. #endif
  27.  
  28. /*
  29.  *    Declarations
  30.  */
  31.  
  32. #define CLOCKS_PER_SEC 60
  33. typedef unsigned long int clock_t;
  34. typedef unsigned long int time_t;
  35. #ifdef powerc
  36. #pragma options align=power
  37. #endif
  38. struct tm {
  39.     int tm_sec;        /* Seconds after the minute -- [0, 61] */
  40.     int tm_min;        /* Minutes after the hour -- [0, 59] */
  41.     int tm_hour;    /* Hours after midnight -- [0, 23] */
  42.     int tm_mday;    /* Day of the month -- [1, 31] */
  43.     int tm_mon;        /* Months since January -- [0, 11] */
  44.     int tm_year;    /* Years since 1900 */
  45.     int tm_wday;    /* Days since Sunday -- [0, 6] */
  46.     int tm_yday;    /* Days since January 1 -- [0, 365] */
  47.     int tm_isdst;    /* Daylight Savings Time flag */
  48. };
  49. #ifdef powerc
  50. #pragma options align=reset
  51. #endif
  52.  
  53. #ifdef __cplusplus
  54. extern "C" {
  55. #endif
  56.  
  57. /*
  58.  *    Time manipulation functions
  59.  */
  60.  
  61. clock_t clock(void);                        /* function */
  62. #ifndef powerc
  63. #define clock() __tickcount()                /* macro - TickCount() */
  64. pascal unsigned long __tickcount(void)
  65.     = 0xA975; 
  66. #endif /* powerc */
  67.  
  68. double  difftime(time_t time1, time_t time0);                /* function */
  69. #define difftime(time1,time0) ((long double)time1 - time0)    /* macro */
  70.  
  71. time_t mktime(struct tm *timeptr);
  72. time_t time(time_t *timer);
  73.  
  74.  
  75. /*
  76.  *    Time conversion functions
  77.  */
  78.  
  79. char *asctime (const struct tm *timeptr);
  80. char *ctime(const time_t *timer);
  81. struct tm *gmtime(const time_t *timer);
  82. struct tm *localtime(const time_t *timer);
  83. size_t strftime(char *s, size_t maxsize,
  84.                  const char *format, const struct tm *timerptr);
  85.  
  86. #ifdef __cplusplus
  87. }
  88. #endif
  89.  
  90. #endif
  91.